{include admin.inc.header}

{include admin.inc.top}

<div class="container-fluid content-body">
	<div class="main">
		{include admin.inc.menu}

		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">

				<ul class="breadcrumb">
					<li>
						<i class="glyphicon glyphicon-home"></i>
						<span>当前位置：</span>
						<a href="#">{$breadcrumb[0]}</a>
						<i class="glyphicon glyphicon-chevron-right"></i>
						<a href="#">{$breadcrumb[1]}</a>
					</li>
				</ul>

				<!-- Nav tabs -->
				<ul class="nav nav-tabs">
					{if $loginUser->hasPermission('admin/mpe/add')}
					<li><a href="{$add_url}"><i class="glyphicon glyphicon-plus"></i> 开通MPE</a></li>
					{/if}
					<li class="active"><a href="{$index_url}"><i class="glyphicon glyphicon-th-list"></i> MPE列表</a></li>
					<li><a href="javascript:void(0);"><i class="glyphicon glyphicon-edit"></i> 编辑MPE</a></li>
				</ul>

				<div class="inner-container">

					<!-- search form start -->
					<form class="form-inline form-search" role="form" id="search-form" autocomplete="off">
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-btn">
									<select class="form-control input-sm search-options" name="select_name">
										<option value="mobile" {if $params[select_name]=='mobile'}selected{/if}>手机号码</option>
										<option value="contacter" {if $params[select_name]=='contacter'}selected{/if}>联系人</option>
										<option value="level2_domain" {if $params[select_name]=='level2_domain'}selected{/if}>二级域名</option>
										<option  value="domain" {if $params[select_name]=='domain'}selected{/if}>一级域名</option>
									</select>
								</div><!-- /btn-group -->
								<input  type="text" name="mobile" value="{$params[$params['select_name']]}" class="form-control input-sm">
							</div>
						</div>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">应用状态</div>
								<select class="form-control input-sm" name="status">
									<option value="-1">全部</option>
									{loop $cstatus $key $val}
									<option value="{$key}" {if $params[status]==$key}selected{/if}>{$val}</option>
									{/loop}
								</select>
							</div>
						</div>

						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">开通期限</div>
								<div class="form-inline">
									<input type="text" name="starttime" value="{$params[starttime]}" class="form-control input-sm mdate" placeholder="开始日期">
									<input type="text" name="endtime" value="{$params[endtime]}" class="form-control input-sm mdate" placeholder="结束日期">
								</div>
							</div>
						</div>

						<button type="submit" class="btn btn-success btn-sm">
							<i class="glyphicon glyphicon-search"></i> 搜索</button>
						{data_export_btn}

					</form><!-- END search form -->

					<form id="J_List_Form" autocomplete="off">
						<div class="table-responsive">
							<table class="table table-bordered table-hover" id="J_List_Table">
								<thead>
								<tr>
									<th width="20"><input type="checkbox" class="icheck check-all" /></th>
									{loop $tableHeader $val}
									<th>{$val}</th>
									{/loop}
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
								{if empty($items)}
								<tr>
									<td class="no-records text-center">{$noRecords}</td>
								</tr>
								{/if}
								{loop $items $value}
								<tr>
									<td><input type="checkbox" class="icheck" name="ids[]" value="{$value[id]}" id="checkbox_row_{$value[id]}" /></td>
									<td><label for="checkbox_row_{$value[id]}">{$value[company]}</label></td>
									<td>{$value[contacter]}</td>
									<td>{$value[mobile]}</td>
									<td>{$value[virtual_name]}</td>
									<td>{$value[virtual_account]}</td>
									<td>{$value[level2_domain]}</td>
									<td>{$value[domain]}</td>
									<td>{$value[addtime]}</td>
									<td>
										{if $value[end_time]}
										<span class="label label-primary">{$value[start_time]}</span> -
										<span class="label label-primary">{$value[end_time]}</span>
										{else}
										<span class="label label-success">永久开通</span>
										{/if}
									</td>
									<td>
										<div class="bootstrap-switch-swrap">
											<input type="checkbox" data-id="{$value[id]}" data-field="status" class="bswitch bswitch-list" data-size="mini"
												   {if $value[status]==1}checked{/if} data-on-text="启用" data-off-text="禁用">
										</div>
									</td>
									<td>
										{if $loginUser->hasPermission('admin/mpe/update')}
										<a href="#"  class="btn btn-primary btn-xs item-edit" data-id="{$value[id]}">
											<i class="glyphicon glyphicon-edit"></i> 修改</a>
										{/if}
									</td>
								</tr>
								{/loop}
								</tbody>
							</table>
						</div>
					</form>

					<div class="text-right">
						{$pagemenu}
					</div>

				</div>

			</div><!-- end of inner -->
		</section>

	</div>
</div>

{include admin.inc.footer}

<script type="text/html" id="content-add-template">
	<form role="form" class="content-add-form form-horizontal" id="content-add-form" autocomplete="off">

		<div class="form-group">
			<label class="col-sm-3 control-label">一级域名</label>
			<div class="col-sm-9">
				<input type="text" name="data[domain]" value="{[item.domain]}" class="form-control" maxlength="30" placeholder="一级域名" />
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 二级域名</label>
			<div class="col-sm-9">
				<input type="text" name="data[level2_domain]" value="{[item.level2_domain]}" class="form-control" maxlength="30" placeholder="二级域名" required />
				<p class="help-block">只要填写前缀就好了，比如说app.dasu123.com只要写app就好了,不需要写dasu123.com</p>
				<input type="hidden" name="level2_domain" value="{[item.level2_domain]}">
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 联系人</label>
			<div class="col-sm-9">
				<input type="text" name="data[contacter]" value="{[item.contacter]}" class="form-control" maxlength="20" placeholder="联系人" required />
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 联系电话</label>
			<div class="col-sm-9">
				<input type="text" name="data[mobile]" dtype="mobile" value="{[item.mobile]}" class="form-control" maxlength="11" placeholder="联系电话" required />
				<p class="help-block">请输入手机号码</p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 后台管理员用户</label>
			<div class="col-sm-9">
				<input type="text" name="data[admin_user]" value="{[item.admin_user]}" class="form-control" maxlength="20" placeholder="后台管理员用户" readonly />
				<p class="help-block"></p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 后台管理员密码</label>
			<div class="col-sm-9">
				<input type="text" name="data[admin_pass]" value="" class="form-control" maxlength="20" placeholder="后台管理员密码" />
				<p class="help-block">不改请留空</p>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label"><span class="asterisk">*</span> 开通期限</label>
			<div class="col-sm-9">
				<div class="form-inline">
					<input class="form-control mdate" name="data[start_time]" value="{[item.start_time]}" type="text" placeholder="开始时间">
					<span class="label label-default">到</span>
					<input class="form-control mdate" name="data[end_time]" value="{[item.end_time]}" type="text" placeholder="结束时间">
				</div>
				<p class="help-block">如果不选结束时间则表示永久卡通</p>
			</div>
		</div>

		<input type="hidden" name="id" value="{[item.id]}">
	</form>
</script>

<script>
	seajs.use("mpe", function(exports) {
		exports.init({
			set_url : '/admin/mpe/set/',
			edit_url : '/admin/mpe/edit/',
			update_url : '/admin/mpe/update/',
		});
	});
</script>
</body>
</html>
